﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Data.Performance
{
    public class a
    {
        public Guid id { get; set; }

        public string Name { get; set; }
    }


    public class b
    {
        public Guid id { get; set; }

        public Guid otherId { get; set; }
    }

    public class GenericityConvert
    {
        public static void mth1<T>(T s)
        {
            var a = (b)Convert.ChangeType(s, typeof(b));
            Console.WriteLine(a.id);
            //Console.WriteLine(a.otherId);
        }

        public static void mth2(object s)
        {
            var a = (b)s;
            Console.WriteLine(a.id);
            //Console.WriteLine(a.otherId);
        }


        public static void mth3<T>(T s)
        {
            var a = JsonConvert.SerializeObject(s);
            var b = JsonConvert.DeserializeObject<b>(a);
            Console.WriteLine(b.id);
            Console.WriteLine(b.otherId);
        }
    }
}
